import { list } from "../../api/index.js";
Page({
  data() {
    return {
      evaluateList: [],
      goodId: ''
    }
  },
  onLoad(options) {
    this.setData({
      goodId: options.goodId
    })
    this.getEvaluateList()
  },
  async getEvaluateList() {
    const params = {
      pageNum: 1,
      pageSize: 100,
      goodId: this.data.goodId,
    };
    const table = 'evaluate';
    const res = await list(params,table)
   if (res.code === 200) {
    const evaluateList = res.rows.map(item => {
      return {
        ...item,
        evaluatePhotos: item.evaluatePhoto 
            ? item.evaluatePhoto.split(',') 
            : []
    };
    });
    this.setData({
      evaluateList: evaluateList
    });
    console.log('evaluateList',this.data.evaluateList[5].evaluatePhotos);
    
   }
  },
  previewImage: function(e) {
    const urls = e.currentTarget.dataset.urls;
    const current = e.currentTarget.dataset.current;
    wx.previewImage({
      current: current, // 当前显示图片的http链接
      urls: urls // 需要预览的图片http链接列表
    });
  },

})